﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TimViec
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            ListItem item=new ListItem();
            item.Text = "Tất cả ngành nghế";
            item.Value = "-1";
            item.Selected = true;

            ListItem item1=new ListItem();
            item1.Text = "Tất cả nơi làm việc";
            item1.Value = "-1";
            item1.Selected = true;

            droNganhNghe.DataSource = BLL.Admin.NganhNgheHelper.List_NganhNghe_ValueConfig(0);
            droNganhNghe.DataTextField = "Ten";
            droNganhNghe.DataValueField = "NganhNgheId";
            droNganhNghe.DataBind();
            droNganhNghe.Items.Add(item);

            droNoiLamViec.DataSource = BLL.Admin.TinhHelper.List_ALL_Tinh();
            droNoiLamViec.DataTextField = "Ten";
            droNoiLamViec.DataValueField = "TinhId";
            droNoiLamViec.DataBind();
            droNoiLamViec.Items.Add(item1);

        }

        protected void btSearch_Click(object sender, EventArgs e)
        {
            var str = "";
            if(txtSearch.Text!="")
            {
                str = "&tk=" + txtSearch.Text;
            }
            Response.Redirect("/tim-viec-lam.html?nganhnghe=" + droNganhNghe.SelectedValue + "&noilam=" + droNoiLamViec.SelectedValue + "&lh=" + droLoaiHinhCongViec.SelectedValue + str);
        }
    }
}